# -*- coding: utf-8 -*-
"""
Created on Tue Oct 24 19:56:52 2023

@author: 楠川之木
"""

def is_perfect_number(n):
    '''
    判断一个整数是否为完数
    '''
    if n <= 0:
        return 0

    factors = [1]  # 1 是任何整数的真因子
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            factors.append(i)
            factors.append(n // i)

    if sum(factors) == n:
        return 1
    else:
        return 0

# 主程序
num = int(input("请输入一个整数: "))
if is_perfect_number(num):
    print("YES")
else:
    print("NO")